package cn.rengy.web.excelcompare.service;

import cn.rengy.isql.Dao;
import cn.rengy.lang.ResultEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * 比较任务
 */
@Service
public class ExcelCompareTaskService {
    @Autowired
    private Dao dao;
    @Transactional(rollbackFor = Exception.class)
    public ResultEntity deleteById(Long id){
        //1.删除数据
        dao.update("delete from excel_data1 where task_id=?",id);
        dao.update("delete from excel_data2 where task_id=?",id);
        dao.update("delete from excel_data3 where task_id=?",id);
        //2.删除任务
        dao.update("delete from excel_compare_task where id=?",id);
        return ResultEntity.ok();
    }
}
